﻿@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment HostingEnvironment
@{
    ShowTenantDto tenant = ViewBag.CurrentTenant;
    string tenantIcoUrl = "/favicon.ico";
    string tenantThumbnailUrl = "/images/no-thumbnail.png";
    string tenantImageUrl = "/images/no-image.png";
    string tenantShortName = "null";
    string tenantDescription = "null";
    if (tenant != null)
    {
        if (tenant.Id == "0")
        {
            tenantThumbnailUrl = "/images/tenant/logo.png";
            tenantImageUrl = "/images/tenant/trademark.png";
            tenantIcoUrl = "/images/tenant/ico.ico";
        }
        else
        {
            if (!tenant.ThumbnailPostfix.IsNullOrEmpty())
            {
                var fileName = "image" + tenant.ThumbnailPostfix;
                tenantThumbnailUrl = Url.Content("~/File/GetImage/Attachment/TenantThumbnail/" + tenant.Id) + "?fileName=" + (fileName) + "&random=" + new Random().Next();
            }
            if (!tenant.ImagePostfix.IsNullOrEmpty())
            {
                var fileName = "image" + tenant.ImagePostfix;
                tenantImageUrl = Url.Content("~/File/GetImage/Attachment/TenantImage/" + tenant.Id) + "?fileName=" + (fileName) + "&random=" + new Random().Next();
            }
            if (tenant.HasIco == 1)
            {
                var fileName = "ico.ico";
                tenantIcoUrl = Url.Content("~/File/GetImage/Attachment/TenantIco/" + tenant.Id) + "?fileName=" + (fileName) + "&random=" + new Random().Next();
            }
        }
        tenantShortName = tenant.ShortName.IsNullOrEmpty() ? "Undefined" : tenant.ShortName;
        tenantDescription = tenant.Description.IsNullOrEmpty() ? "Undefined" : tenant.Description;
    }
}
@await Html.PartialAsync("~/Views/Shared/CustPagePartial.cshtml")

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="keywords" content=@ViewBag.Keywords>
    <meta name="description" content=@ViewBag.TenantDescription>
    <title>@ViewData["Title"] - @tenantShortName</title>

    <link rel="bookmark" href='@Url.Content("~"+ ViewData["CurrentUrl"])' content=@ViewBag.TenantDescription />
    <link rel="shortcut icon" href="@Url.Content("~"+tenantIcoUrl)" type="image/x-icon" />

    <link rel="stylesheet" href='@Url.Content("~/lib/bootstrap/3.3.7/css/bootstrap.min.css")'>
    <link rel="stylesheet" href='@Url.Content("~/lib/fontawesome/4.7.0/css/fontawesome.min.css")'>

    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/app/site/css/site.min.css"))
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/app/site/css/" + "site-theme.min.css"))

</head>
<body>
    <header class="header-background" style="height: 48px;">
        <div class="layout-header header-background" style="height: 48px;">
            <img alt="image" src='@tenantThumbnailUrl' class="img-circle" style="float:left; margin: 5px; height: 38px" />
            <div style="margin-left: 50px; margin-top: 2px;height: 50px;text-align: left;font-size: 16px;line-height: 50px;color: #fff">
                <span>@tenantShortName</span><span style="font-size: 13px;font-weight:200">&nbsp;&nbsp;@tenantDescription</span>
            </div>
        </div>
    </header>

    <div>
        <main role="main">
            @RenderBody()
        </main>
    </div>


</body>
</html>


